<template>
  <div class="config-item-box">
    <span class="item-left">
      {{ name }}
    </span>
    <div
      class="item-right"
      :style="{
        gridTemplateColumns: alone ? '1fr' : '1fr 1fr',
        ...itemRightStyle,
      }"
    >
      <slot />
    </div>
  </div>
</template>

<script>
export default {
  props: {
    name: {
      type: String,
      required: false,
      default: ''
    },
    alone: {
      type: Boolean,
      default: false,
      required: false
    },
    itemRightStyle: {
      type: Object,
      default: () => { },
      required: false
    }
  }
}
</script>

<style lang="scss" scoped>
$leftWidth: 60px;
.config-item-box {
  position: relative;
  display: flex;
  margin: 20px 0;
  .item-left {
    width: $leftWidth;
    text-align: left;
    margin-top: 4px;
    margin-left: 10px;
    font-size: 12px;
  }
  .item-right {
    display: grid;
    grid-column-gap: 10px;
    width: calc(100% - #{$leftWidth});
  }
}
</style>
